package com.example.card.abstracttransactions;

import com.example.card.domain.card.Card;
import com.example.card.CardDataBase;
import com.example.card.domain.user.User;

public abstract class CardModifyTransaction extends UserCheckTransaction {


    protected int id;

    public abstract void change(Card card);

    public CardModifyTransaction(int memberId, int id) {
        super(memberId);
        this.id = id;
    }

    @Override
    public void realExecute(User user) {
        Card card = CardDataBase.getCard(id);
        if (card == null) {
            throw new RuntimeException("卡不存在");
        }
        change(card);
    }


}
